.TH "libwget-mem" 3 "Thu Aug 31 2023" "Version 2.1.0" "lingmoGet" \" -*- nroff -*-
.ad l
.nh
.SH NAME
libwget-mem \- Memory functions
.SH SYNOPSIS
.br
.PP
.SS "Functions"

.in +1c
.ti -1c
.RI "void * \fBwget_memdup\fP (const void *m, size_t n)"
.br
.ti -1c
.RI "char * \fBwget_strdup\fP (const char *s)"
.br
.ti -1c
.RI "char * \fBwget_strmemdup\fP (const void *m, size_t n)"
.br
.ti -1c
.RI "size_t \fBwget_strmemcpy\fP (char *s, size_t ssize, const void *m, size_t n)"
.br
.ti -1c
.RI "void * \fBwget_strmemcpy_a\fP (char *s, size_t ssize, const void *m, size_t n)"
.br
.in -1c
.SH "Detailed Description"
.PP 
This is a collections of short memory function not available in standard libraries\&. 
.SH "Function Documentation"
.PP 
.SS "void * wget_memdup (const void * m, size_t n)"

.PP
\fBParameters\fP
.RS 4
\fIm\fP Memory to clone 
.br
\fIn\fP Length of memory 
.RE
.PP
\fBReturns\fP
.RS 4
Cloned memory
.RE
.PP
Clone's the memory region \fCm\fP with length \fCn\fP\&. Returns NULL if \fCm\fP is NULL\&.
.PP
You should free() the returned pointer when not needed any more\&. 
.SS "char * wget_strdup (const char * s)"

.PP
\fBParameters\fP
.RS 4
\fIs\fP String to clone 
.RE
.PP
\fBReturns\fP
.RS 4
Cloned string
.RE
.PP
Clone's the string \fCs\fP like strdup() does\&. Returns NULL if \fCs\fP is NULL\&.
.PP
You should free() the returned string when not needed any more\&. 
.SS "char * wget_strmemdup (const void * m, size_t n)"

.PP
\fBParameters\fP
.RS 4
\fIm\fP Memory to convert into string 
.br
\fIn\fP Length of memory 
.RE
.PP
\fBReturns\fP
.RS 4
Created string
.RE
.PP
Convert the given memory region \fCm\fP with length \fCn\fP into a C string\&. Returns NULL if \fCm\fP is NULL\&.
.PP
You should free() the returned string when not needed any more\&. 
.SS "size_t wget_strmemcpy (char * s, size_t ssize, const void * m, size_t n)"

.PP
\fBParameters\fP
.RS 4
\fIs\fP Buffer to hold the C string output 
.br
\fIssize\fP Size of the output buffer 
.br
\fIm\fP Memory to read from 
.br
\fIn\fP Length of memory 
.RE
.PP
\fBReturns\fP
.RS 4
Number of bytes copied, not counting the trailing 0 byte
.RE
.PP
Convert the given memory region \fCm\fP with length \fCn\fP into a C string at \fCs\fP\&. A max\&. of \fCssize\fP - 1 is copied into \fCs\fP\&. 
.SS "void * wget_strmemcpy_a (char * s, size_t ssize, const void * m, size_t n)"

.PP
\fBParameters\fP
.RS 4
\fIs\fP Buffer to hold the C string output 
.br
\fIssize\fP Size of the output buffer 
.br
\fIm\fP Memory to read from 
.br
\fIn\fP Length of memory 
.RE
.PP
\fBReturns\fP
.RS 4
Pointer to destination (either \fCs\fP or a freshly allocated buffer)
.RE
.PP
Convert the given memory region \fCm\fP with length \fCn\fP into a C string at \fCs\fP or at freshly allocated memory, if the space in \fCs\fP was not sufficient\&.
.PP
If \fCs\fP was too small to hold \fCn\fP + 1 bytes, the result must be free'd after use, e\&.g\&. if (res != s) wget_free(res); 
.SH "Author"
.PP 
Generated automatically by Doxygen for lingmoGet from the source code\&.
